<template>
	<view>
		<view class="item" v-for="(res, index) in addressList" :key="res.id" @tap="goSendOrder(res.id)">
			<view class="left">
				<view class="top">
					<view class="name">{{ res.name }}</view>
					<view class="phone">{{ res.mobile }}</view>
				</view>
				<view class="bottom">
					{{ res.address }}
				</view>

			</view>
			<view class="right">
				<!-- 选择 -->
				<!-- <u-icon name="checkbox-mark" size="30" color="#f00"></u-icon> -->

			</view>
		</view>
	</view>
</template>

<script>
	import {getAddressList} from '@/api/api.js';

export default {
	data() {
		return {
			siteList: [],
			addressList: [],
		};
	},
	onLoad() {
		this.getData();
	},
	methods: {
		async getData() {
			
			await getAddressList().then((res) => {
				console.log(res);
				this.addressList = res;
			}).catch(() => {
					
			})
		},
		goSendOrder(id) {
			console.log(id);
			uni.redirectTo({
			    url: '/pages/order/send?addressid=' + id
			});
		}
		
	}
};
</script>

<style lang="scss" scoped>
.item {
	padding: 40rpx 20rpx;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1rpx solid #ccc;
	.top {
		display: flex;
		font-weight: bold;
		font-size: 34rpx;
		.phone {
			margin-left: 60rpx;
		}
		.tag {
			display: flex;
			font-weight: normal;
			align-items: center;
			text {
				display: block;
				width: 60rpx;
				height: 34rpx;
				line-height: 34rpx;
				color: #ffffff;
				font-size: 20rpx;
				border-radius: 6rpx;
				text-align: center;
				margin-left: 30rpx;
				background-color:rgb(49, 145, 253);
			}
			.red{
				background-color:red
			}
		}
	}
	.bottom {
		display: flex;
		margin-top: 20rpx;
		font-size: 28rpx;
		justify-content: space-between;
		color: #999999;
	}
}

</style>
